home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / msql-1.0.6 / src / makedepend / def.h < prev    next >
C/C++ Source or Header  |  1994-11-27  |  4KB  |  124 lines

  1. /* $XConsortium: def.h,v 1.25 94/04/17 20:10:33 gildea Exp $ */
  2. /*
  3.  
  4. Copyright (c) 1993, 1994  X Consortium
  5.  
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  19. X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22.  
  23. Except as contained in this notice, the name of the X Consortium shall not be
  24. used in advertising or otherwise to promote the sale, use or other dealings
  25. in this Software without prior written authorization from the X Consortium.
  26.  
  27. */
  28.  
  29. #define    X_NOT_POSIX
  30.  
  31. #include <stdio.h>
  32. #include <ctype.h>
  33. #include <sys/types.h>
  34. #include <fcntl.h>
  35. #include <sys/stat.h>
  36.  
  37. #define MAXDEFINES    512
  38. #define MAXFILES    512
  39. #define MAXDIRS        64
  40. #define SYMTABINC    10    /* must be > 1 for define() to work right */
  41. #define    TRUE        1
  42. #define    FALSE        0
  43.  
  44. /* the following must match the directives table in main.c */
  45. #define    IF        0
  46. #define    IFDEF        1
  47. #define    IFNDEF        2
  48. #define    ELSE        3
  49. #define    ENDIF        4
  50. #define    DEFINE        5
  51. #define    UNDEF        6
  52. #define    INCLUDE        7
  53. #define    LINE        8
  54. #define    PRAGMA        9
  55. #define ERROR           10
  56. #define IDENT           11
  57. #define SCCS            12
  58. #define ELIF            13
  59. #define EJECT           14
  60. #define IFFALSE         15     /* pseudo value --- never matched */
  61. #define ELIFFALSE       16     /* pseudo value --- never matched */
  62. #define INCLUDEDOT      17     /* pseudo value --- never matched */
  63. #define IFGUESSFALSE    18     /* pseudo value --- never matched */
  64. #define ELIFGUESSFALSE  19     /* pseudo value --- never matched */
  65.  
  66. #ifdef DEBUG
  67. extern int    _debugmask;
  68. /*
  69.  * debug levels are:
  70.  * 
  71.  *     0    show ifn*(def)*,endif
  72.  *     1    trace defined/!defined
  73.  *     2    show #include
  74.  *     3    show #include SYMBOL
  75.  *     4-6    unused
  76.  */
  77. #define debug(level,arg) { if (_debugmask & (1 << level)) warning arg; }
  78. #else
  79. #define    debug(level,arg) /**/
  80. #endif /* DEBUG */
  81.  
  82. typedef    unsigned char boolean;
  83.  
  84. struct symtab {
  85.     char    *s_name;
  86.     char    *s_value;
  87. };
  88.  
  89. struct    inclist {
  90.     char        *i_incstring;    /* string from #include line */
  91.     char        *i_file;    /* path name of the include file */
  92.     struct inclist    **i_list;    /* list of files it itself includes */
  93.     int        i_listlen;    /* length of i_list */
  94.     struct symtab    *i_defs;    /* symbol table for this file */
  95.     int        i_ndefs;    /* current # defines */
  96.     int        i_deflen;    /* amount of space in table */
  97.     boolean        i_defchecked;    /* whether defines have been checked */
  98.     boolean        i_notified;    /* whether we have revealed includes */
  99.     boolean        i_marked;    /* whether it's in the makefile */
  100.     boolean        i_searched;    /* whether we have read this */
  101.     boolean         i_included_sym; /* whether #include SYMBOL was found */
  102.                     /* Can't use i_list if TRUE */
  103. };
  104.  
  105. struct filepointer {
  106.     char    *f_p;
  107.     char    *f_base;
  108.     char    *f_end;
  109.     long    f_len;
  110.     long    f_line;
  111. };
  112.  
  113. char            *malloc();
  114. char            *realloc();
  115. char            *copy();
  116. char            *base_name();
  117. char            *getline();
  118. struct symtab        *slookup();
  119. struct symtab        *isdefined();
  120. struct symtab        *fdefined();
  121. struct filepointer    *getfile();
  122. struct inclist        *newinclude();
  123. struct inclist        *inc_path();
  124.